package com.szly.phm.common.entity.result;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

@Data
public class PageResult<T> {

    @ApiModelProperty(value = "页码")
    private int pageNum;
    @ApiModelProperty(value = "每页的数量")
    private int pageSize;
    @ApiModelProperty(value = "结果")
    private List<T> list;
    @ApiModelProperty(value = "总数量")
    private long rowCount;

    public static <T> PageResult page(List<T> list, int pageNum, int pageSize, long rowCount) {
        PageResult pageResult = new PageResult();
        pageResult.setList(list);
        pageResult.setPageNum(pageNum);
        pageResult.setPageSize(pageSize);
        pageResult.setRowCount(rowCount);
        return pageResult;
    }

}
